<template>
	<view>
		<view class="settle-container">
			<!-- 全选按钮 -->
			<view class="left">
				<label class="radio" @click="changeAllState">
					<radio value="全选" :checked="isFullCheck" color="#c00000" /><text></text>
				</label>
			</view>
			<!-- 合计 -->
			<view class="middle">
				合计<text>￥{{checkedGoodsAmount}}</text>
			</view>
			<!-- 结算按钮 -->
			<view class="right">
				<view class="btn-settle">结算({{checkedCount}})</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapGetters,mapMutations} from 'vuex'
	export default {
		name: "my-settle",
		data() {
			return {

			};
		},
		computed:{
			...mapGetters('my_cart',['checkedCount','total','checkedGoodsAmount']),
			// 是否全选
			isFullCheck(){
			return this.total===this.checkedCount
			}
		},
		methods:{
			...mapMutations('my_cart',['updateAllGoodsState']),
			changeAllState(){
				this.updateAllGoodsState(!this.isFullCheck)
			}
		}
	}
</script>

<style lang="scss">
	.settle-container {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		border-top: 1px solid #efefef;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #fff;

		.left {
			display: flex;
			align-items: center;
		}

		.middle {
			.price {
				color: #c00000;
				font-size: 18px;
			}
		}

		.right {
			.btn-settle {
				line-height: 50px;
				min-width: 100px;
				text-align: center;
				background-color: #c00000;
				color: #fff;
			}
		}
	}
</style>
